﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace InitiativeTracker
{
    public partial class CreateNewStat : Form
    {
        public Action<EntryHelper, EntryHelper> confirm;
        EntryHelper name;
        EntryHelper value;

        public CreateNewStat()
        {
            InitializeComponent();
            name = new EntryHelper("New Stat", new Point(10, 10));
            value = new EntryHelper("Value", new Point(10, 50));

            this.Controls.Add(name.LABEL);
            this.Controls.Add(name.TEXTBOX);
            this.Controls.Add(value.LABEL);
            this.Controls.Add(value.TEXTBOX);
        }

        private void Cancel_Click(object sender, EventArgs e)
        {
            confirm = null;
            this.Close();
        }

        public void ConfirmationSubscription(Action<EntryHelper,EntryHelper> ConfirmationAction)
        {
            confirm = ConfirmationAction;
        }

        private void Confirm_Click(object sender, EventArgs e)
        {
            if (confirm != null)
            {
                confirm(name,value);
            }
            this.Close();
        }
    }
}
